package com.example.workrecord.util;


import org.slf4j.LoggerFactory;

/**
 * @ClassName: Logger
 * @Description: 日志工具类
 * @Author: Wei
 * @Date: 2018/7/30 11:58
 * @Version: 1.0
 */
public class Logger {

    private org.slf4j.Logger logger4j;

    /**
     * 构造方法，初始化Slf4j的日志对象
     */
    private Logger(org.slf4j.Logger slf4jLogger) {
        logger4j = slf4jLogger;
    }

    /**
     * 获取构造器，根据类初始化Logger对象
     * <p>
     * Class对象
     *
     * @return Logger对象
     */
    public static Logger getLogger(Class classObject) {
        return new Logger(LoggerFactory.getLogger(classObject));
    }

    /**
     * 获取构造器，根据类名初始化Logger对象
     * <p>
     * 类名字符串
     *
     * @return Logger对象
     */
    public static Logger getLogger(String logger4jName) {
        return new Logger(LoggerFactory.getLogger(logger4jName));
    }

    public void trace(Object object) {
        String msg = object.toString();
        logger4j.trace(msg);
    }

    public void trace(String format, Object arg) {
        logger4j.trace(format, arg);
    }

    public void trace(String format, Object arg1, Object arg2) {
        logger4j.trace(format, arg1, arg2);
    }

    public void trace(String format, Object... arguments) {
        logger4j.trace(format, arguments);
    }

    public void trace(Object object, Throwable e) {
        String msg = object.toString();
        logger4j.trace(msg, e);
    }

    public void debug(Object object) {
        String msg = object.toString();
        logger4j.debug(msg);
    }

    public void debug(Object object, Throwable e) {
        String msg = object.toString();
        logger4j.debug(msg, e);
    }

    public void debug(String format, Object arg) {
        logger4j.debug(format, arg);
    }

    public void debug(String format, Object arg1, Object arg2) {
        logger4j.debug(format, arg1, arg2);
    }

    public void debug(String format, Object... arguments) {
        logger4j.debug(format, arguments);
    }

    public void info(Object object) {
        String msg = object.toString();
        logger4j.info(msg);
    }

    public void info(Object object, Throwable e) {
        String msg = object.toString();
        logger4j.info(msg, e);
    }

    public void info(String format, Object arg) {
        logger4j.info(format, arg);
    }

    public void info(String format, Object arg1, Object arg2) {
        logger4j.info(format, arg1, arg2);
    }

    public void info(String format, Object... arguments) {
        logger4j.info(format, arguments);
    }

    public void warn(Object object) {
        String msg = object.toString();
        logger4j.warn(msg);
    }

    public void warn(Object object, Throwable e) {
        String msg = object.toString();
        logger4j.warn(msg, e);
    }

    public void warn(String format, Object arg) {
        logger4j.warn(format, arg);
    }

    public void warn(String format, Object arg1, Object arg2) {
        logger4j.warn(format, arg1, arg2);
    }

    public void warn(String format, Object... arguments) {
        logger4j.warn(format, arguments);
    }

    public void error(Object object) {
        String msg = object.toString();
        logger4j.error(msg);
    }

    public void error(Object object, Throwable e) {
        String msg = object.toString();
        logger4j.error(msg, e);
    }

    public void error(Object object, Object arg) {
        String format = object.toString();
        logger4j.error(format, arg);
    }

    public void error(String format, Object arg1, Object arg2) {
        logger4j.error(format, arg1, arg2);
    }

    public void error(String format, Object... arguments) {
        logger4j.error(format, arguments);
    }

    public String getName() {
        return logger4j.getName();
    }

    public org.slf4j.Logger getSlf4jLogger() {
        return logger4j;
    }

    public boolean equalsLogger(org.slf4j.Logger newLogger) {
        return logger4j.equals(newLogger);
    }

    public boolean isDebugEnabled() {
        return logger4j.isDebugEnabled();
    }

    public boolean isErrorEnabled() {
        return logger4j.isErrorEnabled();
    }
}